02-use-cases/pay-for-api-agent: add AgentCore Payments Pay-for-API#1504
02-use-cases/pay-for-api-agent: add AgentCore Payments Pay-for-API#1504ggChris2 wants to merge 1 commit into
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
Latest scan for commit: Security Scan ResultsScan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies: Column Explanations: Severity Levels (S/C/H/M/L/I):
Other Columns:
Scanner Results:
Severity Thresholds (Thresh Column):
Threshold Source: Values in parentheses indicate where the threshold is configured:
Statistics calculation:
|
1c5c0c4 to
70724dc
Compare
b7023a0 to
b12c144
Compare
…d use case Strands buyer agent that pays autonomously for a metered HTTP API via AgentCore Payments. The seller is a Fun Facts API behind API Gateway + Lambda that returns HTTP 402 with an x402 payment requirement; the agent consumes the requirement, calls ProcessPayment via the AgentCorePaymentsPlugin, retries the request with the signature header, and returns the fact along with the dollar amount spent. Includes: - Fun Facts seller (CDK + Lambda + x402 facilitator integration) - Buyer agent (Strands + bedrock-agentcore plugin) - Two credential providers (Coinbase CDP + Privy) - Four payment instruments (EVM + Solana per provider) - AgentCore Runtime deployment via CodeBuild (no local Docker) - AgentCore Memory wiring for per-user session continuity - CloudWatch + X-Ray observability with vended log delivery The notebook clones the Privy Wallet Hub frontend from privy-io/aws-agentcore-sdk on first run (Apache-2.0, jointly maintained by Privy and AWS AgentCore) and drives its lifecycle inline. The clone target lives under privy-delegation/ and is gitignored so it never re-enters the repo.
b12c144 to
df9f4d0
Compare
| role=build_trigger_role, | ||
| timeout=Duration.minutes(15), | ||
| memory_size=128, | ||
| code=aws_lambda.Code.from_inline( |
| """Pay for API — buyer agent CDK stack. | ||
|
|
||
| Provisions the full AgentCore Runtime stack for the buyer agent **without | ||
| requiring Docker on the machine running `cdk deploy`**: |
There was a problem hiding this comment.
Also - why did you need a Lambda to provision runtime? I understand to work around the need for docker (smart!) but it looks like it's possible doing it without a provisioner lambda?
There was a problem hiding this comment.
Thanks! I used this method to orchestrate CodeBuild. I appreciate you pointing me to this blog. I was using this method mid-2025 to bridge CloudFormation and CodeBuild. I could refactor, but from now on will use the method in the blog
| @@ -0,0 +1,363 @@ | |||
| #!/usr/bin/env bash | |||
| # setup-roles.sh — create the four IAM roles the notebook assumes into. | |||
There was a problem hiding this comment.
do we still need this file if you've set up roles via CDK?
There was a problem hiding this comment.
Yes the user runs the CDK in the later steps to provision the seller and for runtime. Before the runtime they need to configure the Control Plane, and then deploy the Agent on AgentCore Runtime. Let me know what your thought are here
…e case
Strands buyer agent that pays autonomously for a metered HTTP API via AgentCore Payments. The seller is a Fun Facts API behind API Gateway + Lambda that returns HTTP 402 with an x402 payment requirement; the agent consumes the requirement, calls ProcessPayment via the AgentCorePaymentsPlugin, retries the request with the signature header, and returns the fact along with the dollar amount spent.
Includes:
Notebook walks through cred-provider setup, manager + connector + four instruments, two sessions, four (provider, network) local agent runs, and a runtime deploy with the same four-run matrix.
Amazon Bedrock AgentCore Samples Pull Request
Important
review readylabel to it. Only PRs withreview readywill be reviewed.Issue number:
Concise description of the PR
User experience
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.